#ifndef TCP_CILENT_H__
#define TCP_CILENT_H__

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "types.h"

#ifdef __cplusplus
extern "C" {
#endif


typedef void*  TcpClient;

TcpClient tcpclient_new(SocketParser* parser);
TcpClient tcpclient_from(int fd, SocketParser* parser);

int tcpclient_send_raw(TcpClient client, char* buf, int length);

Message* tcpclient_recv_msg(TcpClient client);

int tcpclient_recv_raw(TcpClient client, char* buf, int length);

int tcpclient_connect(TcpClient client, char* ip, int port);
int tcpclient_is_valid(TcpClient client);
void tcpclient_close(TcpClient client);
void tcpclient_del(TcpClient client);

#ifdef __cplusplus
}
#endif

#endif  // TCP_CILENT_H__